package com.example.nextstream.config;
import com.example.nextstream.utils.RspBuilder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {
    @ResponseBody
    @ExceptionHandler(Exception.class)
    public Object handleException(Exception e) {
       // logger.error(ExceptionUtils.getFullStackTrace(e));  // 记录错误信息

        return RspBuilder.formatFailResult(e.toString());
    }
}
